unit uTypes;

interface

uses EbayConnect, Classes, googleTranslator, cxGridCustomTableView ;

type

  TSearchThreadStatus = record
    TotalPages : Integer;
    LoadedPages : Integer;
    TotalItems : Integer;
    LoadedItems : Integer;
    SavedItems : Integer;
    CurrentCategory : Integer;
    TotalCategories : Integer;
    ThreadID : Integer;
    Operation : string;
  end;

  TSOperation = (opEdit,opNew);

  TDownloadImageThreadStatus = record
    TotalItems : Integer;
    SavedPhotos : Integer
  end;

 TItemDetails = record
    ItemID : string;
    ItemTitle : string;
    URL : string;
    Price : Real;
    PriceCurrency : string;
    BuyItNowPrice : Real;
    BuyItNowCurrency : string;
    SellerID : string;
    ItemLocation : string;
    country : string;
    ShippingCost : Real;
    ShippingCostCurrency : string;
    GalleryURL : string;
    PictureURL : string;
    StartTime : TDateTime;
    EndTime : TDateTime;
    ListingType : string;
    SearchID : Integer;
    Updated : TDateTime;
    CategoryID : string;
    categoryName : string;
    Description : string;
    globalId : string;
    PaymentMethods : string;
    BidCount : Integer;
    ListingStatus : string;
    QuantitySold : Integer;
    ReserveMet : Boolean;
    ShipToLocations : string;
  end;

  TAspect = record
    AspectValName : string;
    Aspectcnt : Integer;
  end;

  TAspectArray = array of TAspect;

  ListingTypes =(AdFormat, Auction, AuctionWithBIN, Classified, FixedPrice, StoreInventory, All);

  Tinisettings = record
    // database
    DataPath : string;
    // sheduling
    autorun : Boolean;
    checkregular : Boolean;
    Checkperiod : Integer;
    //autorunsearch : Boolean;
    runminimized : Boolean;
    // ebay
    AppID : string;
    DevID : string;
    CertID : string;
    Token : string;
    timeshiftebay : TDateTime;
    DecimalSeparator : Char;
    CSVSeparator : Char;
    ShowLatsResults : Integer;
    NotOlder : Integer;
    ClearData : Boolean;
    xmloutput : Boolean;
    logfolder : string;
    dblogfilename : string;
  end;

  TCatRec = record
    CategoryID : Integer;
    CategoryLevel : Integer;
    CategoryName: string;
    CategoryParentID : Integer;
    LeafCategory : Boolean;
    SavedCategoriesCnt : Integer;
    CatCount : Integer;
    FGlobalSiteID : Global_ID;
  end;

  TGridTrRec = class(TCollectionItem)
  private
    FItemID : string;
    FItemTitle : string;
    Fthread : TTranslateThread;
    FSender: TcxCustomGridTableItem;
    FRecord: TcxCustomGridRecord;
    FInTranslation : Boolean;
  public
    constructor Create(Collection: TCollection); override;
    destructor Destroy; override;
    property Thread : TTranslateThread read Fthread write Fthread;
    property XSender : TcxCustomGridTableItem read FSender write FSender;
    property XRecord : TcxCustomGridRecord read FRecord write FRecord;
    property XInTranslation : Boolean read FInTranslation write FInTranslation;
  published
    property ItemID : string  read FItemID write FItemID;
    property ItemTitle : string read FItemTitle write FItemTitle;
  end;

  TGridTranslationCollection = class(TCollection)
  private
    function GetGridTrRec(Index: Integer): TGridTrRec;
    procedure SetGridTrRec(Index: Integer; Value: TGridTrRec);
  public
    function Add: TGridTrRec;
    property Items[Index: Integer]: TGridTrRec read GetGridTrRec write SetGridTrRec; default;
  end;


  MFOperations = (opIdle,opCheckCategories,opIdleCat,opSearching,opDowloadImages,opDownloadItemsDetails,opDownloadCategories,opSaveCategories,opLoadAspects);

implementation

{ TGridTrRec }

constructor TGridTrRec.Create(Collection: TCollection);
begin
  inherited;
end;

destructor TGridTrRec.Destroy;
begin
  inherited;
end;

{ TGridTranslationCollection }

function TGridTranslationCollection.Add: TGridTrRec;
begin
  Result := TGridTrRec(inherited Add);
end;

function TGridTranslationCollection.GetGridTrRec(Index: Integer): TGridTrRec;
begin
  Result := TGridTrRec(inherited Items[Index]);
end;

procedure TGridTranslationCollection.SetGridTrRec(Index: Integer;
  Value: TGridTrRec);
begin
  Items[Index].Assign(Value);
end;

end.
